# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-crcmod
pkgname=('python2-crcmod' 'python-crcmod')
_pkgname=crcmod
pkgver=1.7
pkgrel=9
pkgdesc='Cyclic Redundancy Check (CRC) implementation in Python.'
arch=('x86_64' 'aarch64')
url='https://pypi.org/project/crcmod/'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
options=(!emptydirs)
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('3c2f65004761c84f19d6ba95a0af74512108bad5007d9e20f8e684822e4196ce17073e58b47d2fa997e058e3d82782f3393458b6f0e86935418f38877d319a31')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-crcmod() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-crcmod() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

